package zelix.gui.clickguis.N3ro.Utils;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import org.lwjgl.opengl.GL11;
import zelix.utils.hooks.visual.RenderUtils;

import static net.minecraft.client.renderer.GlStateManager.glBegin;
import static org.lwjgl.opengl.GL11.*;

public class RenderUtil {

    public static void rectangleBordered(double x, double y, double x1, double y1, double width, int internalColor, int borderColor) {
        RenderUtil.rectangle(x + width, y + width, x1 - width, y1 - width, internalColor);
        GlStateManager.color((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
        RenderUtil.rectangle(x + width, y, x1 - width, y + width, borderColor);
        GlStateManager.color((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
        RenderUtil.rectangle(x, y, x + width, y1, borderColor);
        GlStateManager.color((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
        RenderUtil.rectangle(x1 - width, y, x1, y1, borderColor);
        GlStateManager.color((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
        RenderUtil.rectangle(x + width, y1 - width, x1 - width, y1, borderColor);
        GlStateManager.color((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
    }

    public static void drawRoundRect_up(double xPosition, double yPosition, double endX, double endY, int radius,
                                        int color) {
        double width = endX - xPosition;
        double height = endY - yPosition;
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + radius, xPosition + width - radius, yPosition + height - radius,
                0,0,color);
        RenderUtil.drawBorderedRect(xPosition, yPosition + radius, xPosition + radius, yPosition + height, 0,0,color);
        RenderUtil.drawBorderedRect(xPosition + width - radius, yPosition + radius, xPosition + width, yPosition + height - radius,
                0,0,color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition, xPosition + width - radius, yPosition + radius, 0,color,color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + height - radius, xPosition + width, yPosition + height,
                0,0,color);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + radius, radius, color, 1);
        //RenderUtil.drawFilledCircle(xPosition + radius, yPosition + height - radius, radius, color, 2);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + radius, radius, color, 3);

        //RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + height - radius, radius, color, 4);
    }
    public static void drawCirCleBorder(double x,double y,double height,double width,int radius,int Color){
        drawRoundRect_up(x,y,x+height,y+width/2,radius,Color);
        drawRoundRect_down(x,y+width/2,x+height,y+width,radius,Color);
    }


    public static void drawRoundRect_down(double xPosition, double yPosition, double endX, double endY, int radius,
                                          int color) {
        double width = endX - xPosition;
        double height = endY - yPosition;
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + radius, xPosition + width - radius, yPosition + height - radius, 0,0,color);
        RenderUtil.drawBorderedRect(xPosition, yPosition + radius, xPosition + radius, yPosition + height - radius, 0,0,color);
        RenderUtil.drawBorderedRect(xPosition + width - radius, yPosition + radius, xPosition + width, yPosition + height - radius,
                0,0,color);
        RenderUtil.drawBorderedRect(xPosition, yPosition, xPosition + width, yPosition + radius, 0,0,color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + height - radius, xPosition + width - radius, yPosition + height,
                0,0,color);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + height - radius, radius, color, 2);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + height - radius, radius, color, 4);
    }

    public static void glColor(int hex) {
        float alpha = (hex >> 24 & 0xFF) / 255.0F;
        float red = (hex >> 16 & 0xFF) / 255.0F;
        float green = (hex >> 8 & 0xFF) / 255.0F;
        float blue = (hex & 0xFF) / 255.0F;
        glColor4f(red, green, blue, alpha);
    }

    public static void drawGradientRect(float x, float y, float x1, float y1, int topColor, int bottomColor) {
        R2DUtils.enableGL2D();
        GL11.glShadeModel((int) 7425);
        GL11.glBegin((int) 7);
        RenderUtil.glColor(topColor);
        GL11.glVertex2f((float) x, (float) y1);
        GL11.glVertex2f((float) x1, (float) y1);
        RenderUtil.glColor(bottomColor);
        GL11.glVertex2f((float) x1, (float) y);
        GL11.glVertex2f((float) x, (float) y);
        GL11.glEnd();
        GL11.glShadeModel((int) 7424);
        R2DUtils.disableGL2D();
    }

    public static void rectangle(double left, double top, double right, double bottom, int color) {
        double var5;
        if (left < right) {
            var5 = left;
            left = right;
            right = var5;
        }
        if (top < bottom) {
            var5 = top;
            top = bottom;
            bottom = var5;
        }
        float var11 = (float)(color >> 24 & 0xFF) / 255.0f;
        float var6 = (float)(color >> 16 & 0xFF) / 255.0f;
        float var7 = (float)(color >> 8 & 0xFF) / 255.0f;
        float var8 = (float)(color & 0xFF) / 255.0f;
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferBuilder = tessellator.getBuffer();
        GlStateManager.enableBlend();
        GlStateManager.disableTexture2D();
        GlStateManager.tryBlendFuncSeparate((int)770, (int)771, (int)1, (int)0);
        GlStateManager.color((float)var6, (float)var7, (float)var8, (float)var11);
        bufferBuilder.begin(7, DefaultVertexFormats.POSITION);
        bufferBuilder.pos(left, bottom, 0.0).endVertex();
        bufferBuilder.pos(right, bottom, 0.0).endVertex();
        bufferBuilder.pos(right, top, 0.0).endVertex();
        bufferBuilder.pos(left, top, 0.0).endVertex();
        tessellator.draw();
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();
        GlStateManager.color((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
    }

    public static void drawBorderedRect(final double x, final double y, final double x2, final double d, final float l1,
                                        final int col1, final int col2) {
        RenderUtil.drawRect(x, y, x2, d, col2);
        final float f = (col1 >> 24 & 0xFF) / 255.0f;
        final float f2 = (col1 >> 16 & 0xFF) / 255.0f;
        final float f3 = (col1 >> 8 & 0xFF) / 255.0f;
        final float f4 = (col1 & 0xFF) / 255.0f;
        glEnable(3042);
        glDisable(3553);
        GL11.glBlendFunc(770, 771);
        glEnable(2848);
        GL11.glPushMatrix();
        glColor4f(f2, f3, f4, f);
        GL11.glLineWidth(l1);
        glBegin(1);
        GL11.glVertex2d(x, y);
        GL11.glVertex2d(x, d);
        GL11.glVertex2d(x2, d);
        GL11.glVertex2d(x2, y);
        GL11.glVertex2d(x, y);
        GL11.glVertex2d(x2, y);
        GL11.glVertex2d(x, d);
        GL11.glVertex2d(x2, d);
        GL11.glEnd();
        GL11.glPopMatrix();
        glEnable(3553);
        glDisable(3042);
        glDisable(2848);
        Gui.drawRect(0,0,0,0,0);
    }
    public static void drawRect(double d, double e, double f, double g, int color) {
        GL11.glPushMatrix();
        glEnable((int) 3042);
        glDisable((int) 3553);
        GL11.glBlendFunc((int) 770, (int) 771);
        glEnable((int) 2848);
        GL11.glPushMatrix();
        RenderUtil.color(color);
        glBegin((int) 7);
        GL11.glVertex2d((double) f, (double) e);
        GL11.glVertex2d((double) d, (double) e);
        GL11.glVertex2d((double) d, (double) g);
        GL11.glVertex2d((double) f, (double) g);
        GL11.glEnd();
        GL11.glPopMatrix();
        glEnable((int) 3553);
        glDisable((int) 3042);
        glDisable((int) 2848);
        GL11.glPopMatrix();
        Gui.drawRect(0,0,0,0,0);
    }

    public static void color(int color) {
        float f = (color >> 24 & 0xFF) / 255.0F;
        float f1 = (color >> 16 & 0xFF) / 255.0F;
        float f2 = (color >> 8 & 0xFF) / 255.0F;
        float f3 = (color & 0xFF) / 255.0F;
        glColor4f(f1, f2, f3, f);
    }

    public static void drawGradientSideways(double left, double top, double right, double bottom, int col1, int col2) {
        float f = (float) (col1 >> 24 & 255) / 255.0f;
        float f1 = (float) (col1 >> 16 & 255) / 255.0f;
        float f2 = (float) (col1 >> 8 & 255) / 255.0f;
        float f3 = (float) (col1 & 255) / 255.0f;
        float f4 = (float) (col2 >> 24 & 255) / 255.0f;
        float f5 = (float) (col2 >> 16 & 255) / 255.0f;
        float f6 = (float) (col2 >> 8 & 255) / 255.0f;
        float f7 = (float) (col2 & 255) / 255.0f;
        glEnable((int) 3042);
        glDisable((int) 3553);
        GL11.glBlendFunc((int) 770, (int) 771);
        glEnable((int) 2848);
        GL11.glShadeModel((int) 7425);
        GL11.glPushMatrix();
        glBegin((int) 7);
        glColor4f((float) f1, (float) f2, (float) f3, (float) f);
        GL11.glVertex2d((double) left, (double) top);
        GL11.glVertex2d((double) left, (double) bottom);
        glColor4f((float) f5, (float) f6, (float) f7, (float) f4);
        GL11.glVertex2d((double) right, (double) bottom);
        GL11.glVertex2d((double) right, (double) top);
        GL11.glEnd();
        GL11.glPopMatrix();
        glEnable((int) 3553);
        glDisable((int) 3042);
        glDisable((int) 2848);
        GL11.glShadeModel((int) 7424);
        Gui.drawRect(0, 0, 0, 0, 0);
    }
    public static void startGlScissor(int x, int y, int width, int height) {
        int scaleFactor = new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor();
        GL11.glPushMatrix();
        glEnable((int) 3089);
        GL11.glScissor((int) (x * scaleFactor), (int) (Minecraft.getMinecraft().displayHeight - (y + height) * scaleFactor),
                (int) (width * scaleFactor), (int) ((height += 14) * scaleFactor));
    }
    public static void drawRoundRect(double xPosition, double yPosition, double endX, double endY,int BorderThincess, int radius,
                                     int color) {
        double width = endX - xPosition;
        double height = endY - yPosition;
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + radius, xPosition + width - radius, yPosition + height - radius,BorderThincess,color
                ,color);
        RenderUtil.drawBorderedRect(xPosition, yPosition + radius, xPosition + radius, yPosition + height - radius,BorderThincess,color, color);
        RenderUtil.drawBorderedRect(xPosition + width - radius, yPosition + radius, xPosition + width, yPosition + height - radius,BorderThincess,color,
                color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition, xPosition + width - radius, yPosition + radius,BorderThincess,color, color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + height - radius, xPosition + width - radius, yPosition + height,BorderThincess,color,
                color);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + radius, radius, color, 1);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + height - radius, radius, color, 2);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + radius, radius, color, 3);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + height - radius, radius, color, 4);
    }
    public static void drawRoundRect(double xPosition, double yPosition, double endX, double endY, int radius,
                                     int color) {
        double width = endX - xPosition;
        double height = endY - yPosition;
        RenderUtil.drawRect(xPosition + radius, yPosition + radius, xPosition + width - radius, yPosition + height - radius,
                color);
        RenderUtil.drawRect(xPosition, yPosition + radius, xPosition + radius, yPosition + height - radius, color);
        RenderUtil.drawRect(xPosition + width - radius, yPosition + radius, xPosition + width, yPosition + height - radius,
                color);
        RenderUtil.drawRect(xPosition + radius, yPosition, xPosition + width - radius, yPosition + radius, color);
        RenderUtil.drawRect(xPosition + radius, yPosition + height - radius, xPosition + width - radius, yPosition + height,
                color);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + radius, radius, color, 1);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + height - radius, radius, color, 2);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + radius, radius, color, 3);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + height - radius, radius, color, 4);
    }

    public static void drawFilledCircle(double x, double y, double r, int c, int id) {
        float f = (float) (c >> 24 & 0xff) / 255F;
        float f1 = (float) (c >> 16 & 0xff) / 255F;
        float f2 = (float) (c >> 8 & 0xff) / 255F;
        float f3 = (float) (c & 0xff) / 255F;
        glEnable(GL_BLEND);
        glDisable(GL_TEXTURE_2D);
        glColor4f(f1, f2, f3, f);
        glBegin(GL_POLYGON);
        if (id == 1) {
            glVertex2d(x, y);
            for (int i = 0; i <= 90; i++) {
                double x2 = Math.sin((i * 3.141526D / 180)) * r;
                double y2 = Math.cos((i * 3.141526D / 180)) * r;
                glVertex2d(x - x2, y - y2);
            }
        } else if (id == 2) {
            glVertex2d(x, y);
            for (int i = 90; i <= 180; i++) {
                double x2 = Math.sin((i * 3.141526D / 180)) * r;
                double y2 = Math.cos((i * 3.141526D / 180)) * r;
                glVertex2d(x - x2, y - y2);
            }
        } else if (id == 3) {
            glVertex2d(x, y);
            for (int i = 270; i <= 360; i++) {
                double x2 = Math.sin((i * 3.141526D / 180)) * r;
                double y2 = Math.cos((i * 3.141526D / 180)) * r;
                glVertex2d(x - x2, y - y2);
            }
        } else if (id == 4) {
            glVertex2d(x, y);
            for (int i = 180; i <= 270; i++) {
                double x2 = Math.sin((i * 3.141526D / 180)) * r;
                double y2 = Math.cos((i * 3.141526D / 180)) * r;
                glVertex2d(x - x2, y - y2);
            }
        } else {
            for (int i = 0; i <= 360; i++) {
                double x2 = Math.sin((i * 3.141526D / 180)) * r;
                double y2 = Math.cos((i * 3.141526D / 180)) * r;
                glVertex2f((float) (x - x2), (float) (y - y2));
            }
        }
        glEnd();
        glEnable(GL_TEXTURE_2D);
        glDisable(GL_BLEND);
    }
    public static void stopGlScissor() {
        glDisable((int) 3089);
        GL11.glPopMatrix();
    }

    public static void drawRoundRectShadow(double xPosition, double yPosition, double endX, double endY,int BorderThincess, int radius,
                                           int color) {
        double width = endX - xPosition;
        double height = endY - yPosition;
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + radius, xPosition + width - radius, yPosition + height - radius,BorderThincess,color
                ,color);
        RenderUtil.drawBorderedRect(xPosition, yPosition + radius, xPosition + radius, yPosition + height - radius,BorderThincess,color, color);
        RenderUtil.drawBorderedRect(xPosition + width - radius, yPosition + radius, xPosition + width, yPosition + height - radius,BorderThincess,color,
                color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition, xPosition + width - radius, yPosition + radius,BorderThincess,color, color);
        RenderUtil.drawBorderedRect(xPosition + radius, yPosition + height - radius, xPosition + width - radius, yPosition + height,BorderThincess,color,
                color);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + radius, radius, color, 1);
        RenderUtil.drawFilledCircle(xPosition + radius, yPosition + height - radius, radius, color, 2);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + radius, radius, color, 3);
        RenderUtil.drawFilledCircle(xPosition + width - radius, yPosition + height - radius, radius, color, 4);

        RenderUtils.drawBorderedRect(xPosition + radius-20, yPosition + radius-20, xPosition + width - radius+20,
                yPosition + height - radius+20, BorderThincess,0x3F1D1D1F, 0x3F1D1D1F);
        RenderUtils.drawBorderedRect(xPosition-20, yPosition + radius-20, xPosition + radius+20, yPosition + height - radius+20, BorderThincess,0x3F1D1D1F, 0x3F1D1D1F);
        RenderUtils.drawBorderedRect(xPosition + width - radius-20, yPosition + radius-20, xPosition + width+20,
                yPosition + height - radius+20, BorderThincess,0x3F1D1D1F, 0x3F1D1D1F);
        RenderUtils.drawBorderedRect(xPosition + radius-20, yPosition-20, xPosition + width - radius+20, yPosition + radius+20, BorderThincess,0x3F1D1D1F,0x3F1D1D1F);
        RenderUtils.drawBorderedRect(xPosition + radius-20, yPosition + height - radius-20, xPosition + width - radius+20,
                yPosition + height+20, BorderThincess,0x3F1D1D1F, 0x3F1D1D1F);
        RenderUtils.drawFilledCircle(xPosition + radius-20, yPosition + radius, radius-20, 0x3F1D1D1F, 1);
        RenderUtils.drawFilledCircle(xPosition + radius-20, yPosition + height - radius-20, radius, 0x3F1D1D1F, 2);
        RenderUtils.drawFilledCircle(xPosition + width - radius-20, yPosition + radius-20, radius, 0x3F1D1D1F, 3);
        RenderUtils.drawFilledCircle(xPosition + width - radius-20, yPosition + height - radius-20, radius, 0x3F1D1D1F, 4);
    }
    public static void drawGradientSidewaysV(double left, double top, double right, double bottom, int col1, int col2) {
        float f = (float) (col1 >> 24 & 255) / 255.0f;
        float f1 = (float) (col1 >> 16 & 255) / 255.0f;
        float f2 = (float) (col1 >> 8 & 255) / 255.0f;
        float f3 = (float) (col1 & 255) / 255.0f;
        float f4 = (float) (col2 >> 24 & 255) / 255.0f;
        float f5 = (float) (col2 >> 16 & 255) / 255.0f;
        float f6 = (float) (col2 >> 8 & 255) / 255.0f;
        float f7 = (float) (col2 & 255) / 255.0f;
        glEnable((int) 3042);
        glDisable((int) 3553);
        GL11.glBlendFunc((int) 770, (int) 771);
        glEnable((int) 2848);
        GL11.glShadeModel((int) 7425);
        GL11.glPushMatrix();
        glBegin((int) 7);
        glColor4f((float) f1, (float) f2, (float) f3, (float) f);
        GL11.glVertex2d((double) left, (double) bottom);
        GL11.glVertex2d((double) right, (double) bottom);
        glColor4f((float) f5, (float) f6, (float) f7, (float) f4);
        GL11.glVertex2d((double) right, (double) top);
        GL11.glVertex2d((double) left, (double) top);
        GL11.glEnd();
        GL11.glPopMatrix();
        glEnable((int) 3553);
        glDisable((int) 3042);
        glDisable((int) 2848);
        GL11.glShadeModel((int) 7424);
        Gui.drawRect(0, 0, 0, 0, 0);
    }
    public static class R2DUtils {
        public static void enableGL2D() {
            glDisable((int) 2929);
            glEnable((int) 3042);
            glDisable((int) 3553);
            GL11.glBlendFunc((int) 770, (int) 771);
            GL11.glDepthMask((boolean) true);
            glEnable((int) 2848);
            GL11.glHint((int) 3154, (int) 4354);
            GL11.glHint((int) 3155, (int) 4354);
        }

        public static void disableGL2D() {
            glEnable((int) 3553);
            glDisable((int) 3042);
            glEnable((int) 2929);
            glDisable((int) 2848);
            GL11.glHint((int) 3154, (int) 4352);
            GL11.glHint((int) 3155, (int) 4352);
        }

        public static void drawRoundedRect(float x, float y, float x1, float y1, int borderC, int insideC) {
            R2DUtils.enableGL2D();
            GL11.glScalef((float) 0.5f, (float) 0.5f, (float) 0.5f);
            R2DUtils.drawVLine(x *= 2.0f, (y *= 2.0f) + 1.0f, (y1 *= 2.0f) - 2.0f, borderC);
            R2DUtils.drawVLine((x1 *= 2.0f) - 1.0f, y + 1.0f, y1 - 2.0f, borderC);
            R2DUtils.drawHLine(x + 2.0f, x1 - 3.0f, y, borderC);
            R2DUtils.drawHLine(x + 2.0f, x1 - 3.0f, y1 - 1.0f, borderC);
            R2DUtils.drawHLine(x + 1.0f, x + 1.0f, y + 1.0f, borderC);
            R2DUtils.drawHLine(x1 - 2.0f, x1 - 2.0f, y + 1.0f, borderC);
            R2DUtils.drawHLine(x1 - 2.0f, x1 - 2.0f, y1 - 2.0f, borderC);
            R2DUtils.drawHLine(x + 1.0f, x + 1.0f, y1 - 2.0f, borderC);
            R2DUtils.drawRect(x + 1.0f, y + 1.0f, x1 - 1.0f, y1 - 1.0f, insideC);
            GL11.glScalef((float) 2.0f, (float) 2.0f, (float) 2.0f);
            R2DUtils.disableGL2D();
            Gui.drawRect(0, 0, 0, 0, 0);
        }

        public static void drawRect(double x2, double y2, double x1, double y1, int color) {
            R2DUtils.enableGL2D();
            R2DUtils.glColor(color, color, color, color);
//							R2DUtils.drawRect(x2, y2, x1, y1, color);
            R2DUtils.drawRect(x2, y2, x1, y1);
            R2DUtils.disableGL2D();
        }

        private static void drawRect(double x2, double y2, double x1, double y1) {
            GL11.glBegin((int) 7);
            GL11.glVertex2d((double) x2, (double) y1);
            GL11.glVertex2d((double) x1, (double) y1);
            GL11.glVertex2d((double) x1, (double) y2);
            GL11.glVertex2d((double) x2, (double) y2);
            GL11.glEnd();
        }

        public static void drawHLine(float x, float y, float x1, int y1) {
            if (y < x) {
                float var5 = x;
                x = y;
                y = var5;
            }
            R2DUtils.drawRect(x, x1, y + 1.0f, x1 + 1.0f, y1);
        }

        public static void drawVLine(float x, float y, float x1, int y1) {
            if (x1 < y) {
                float var5 = y;
                y = x1;
                x1 = var5;
            }
            R2DUtils.drawRect(x, y + 1.0f, x + 1.0f, x1, y1);
        }

        public static void drawHLine(float x, float y, float x1, int y1, int y2) {
            if (y < x) {
                float var5 = x;
                x = y;
                y = var5;
            }
            R2DUtils.drawGradientRect(x, x1, y + 1.0f, x1 + 1.0f, y1, y2);
        }

        public static void drawGradientRect(float x, float y, float x1, float y1, int topColor, int bottomColor) {
            R2DUtils.enableGL2D();
            GL11.glShadeModel((int) 7425);
            GL11.glBegin((int) 7);
            RenderUtil.glColor(topColor);
            GL11.glVertex2f((float) x, (float) y1);
            GL11.glVertex2f((float) x1, (float) y1);
            RenderUtil.glColor(bottomColor);
            GL11.glVertex2f((float) x1, (float) y);
            GL11.glVertex2f((float) x, (float) y);
            GL11.glEnd();
            GL11.glShadeModel((int) 7424);
            R2DUtils.disableGL2D();
        }

        public static void glColor(float alpha, int redRGB, int greenRGB, int blueRGB) {
            float red = 0.003921569F * redRGB;
            float green = 0.003921569F * greenRGB;
            float blue = 0.003921569F * blueRGB;
            glColor4f(red, green, blue, alpha);
        }
    }
}
